<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        DataTable <span class="subitem">RowExpansion</span>
    </ui:define>

    <ui:define name="description">
        A row can be expanded to display detail content using a row expansion column and expansion facet.
    </ui:define>

    <ui:param name="documentationLink" value="/components/datatable"/>
    <ui:param name="widgetLink" value="DataTable-1"/>

    <ui:define name="implementation">
        <div class="card">
            <h:form>
                <p:dataTable var="product" value="#{dtBasicView.products}" rowKey="#{product.id}">
                    <f:facet name="header">
                        Expand rows to see detailed information
                    </f:facet>
                    <p:column style="width:2rem" ariaHeaderText="Row Toggler">
                        <p:rowToggler/>
                    </p:column>

                    <p:column headerText="Name">
                        <h:outputText value="#{product.name}"/>
                    </p:column>

                    <p:column headerText="Image">
                        <p:graphicImage name="demo/images/product/#{product.image}" styleClass="shadow-1" width="100"/>
                    </p:column>

                    <p:column headerText="Price">
                        <h:outputText value="#{product.price}">
                            <f:convertNumber type="currency" currencySymbol="$"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="Category">
                        <h:outputText value="#{product.category}"/>
                    </p:column>

                    <p:column headerText="Reviews">
                        <h:outputText value="#{product.name}"/>
                    </p:column>

                    <p:column headerText="Status">
                        <h:outputText value="#{product.inventoryStatus}"/>
                    </p:column>

                    <p:rowExpansion>
                        <div class="product">
                            <div class="product-list-item">
                                <p:graphicImage name="demo/images/product/#{product.image}"/>
                                <div class="product-list-detail">
                                    <div class="product-name">#{product.name}</div>
                                    <div class="product-description">#{product.description}</div>
                                    <p:rating readonly="true" value="#{product.rating}"/>
                                    <i class="pi pi-tag product-category-icon"/><span
                                        class="product-category">#{product.category}</span>
                                </div>
                                <div class="product-list-action">
                                    <h:outputText value="#{product.price}" styleClass="product-price">
                                        <f:convertNumber currencySymbol="$" type="currency"/>
                                    </h:outputText>
                                    <p:commandButton value="Add To Cart" icon="pi pi-shopping-cart" type="button"
                                                     disabled="#{product.inventoryStatus == 'OUTOFSTOCK'}">
                                    </p:commandButton>
                                    <span class="product-badge status-#{product.inventoryStatus.name().toLowerCase()}">#{product.inventoryStatus.text}</span>
                                </div>
                            </div>
                        </div>
                    </p:rowExpansion>
                </p:dataTable>
            </h:form>
        </div>
    </ui:define>

</ui:composition>
